<?php
declare(strict_types=1);

namespace app\common\lib;

class Show
{
    /**
     * @param string $message
     * @param array $data
     * @return array
     */
    public static function success(array $data = [], string $message = 'OK', int $code = 200)
    {
        $result = [
            'status'  => config('status.success'),
            'message' => $message,
            'result'  => $data
        ];
        return json($result, $code);
    }

    /**
     * @param string $message
     * @param array $data
     * @param int $status
     * @return array
     */
    public static function error(string $message = 'error', int $status = 0, array $data = [], int $code = 200)
    {
        $result = [
            'status'  => $status,
            'message' => $message,
            'result'  => $data
        ];
        return json($result, $code);
    }
}